import React, { Component } from 'react'

export default function createViewWrapper(controller) {
  return class ViewWrapper extends Component {
    componentDidMount() {
      if (controller.componentDidMount) {
        controller.componentDidMount()
      }
    }
    componentWillUnmount() {
			if (controller.componentWillUnmount) {
				controller.componentWillUnmount()
			}
		}
    render() {
      const { View } = controller
      return <View {...this.props} />
    }
  }
}